package com.smart.advisor;

import org.springframework.aop.Pointcut;
import org.springframework.aop.support.ComposablePointcut;
import org.springframework.aop.support.ControlFlowPointcut;
import org.springframework.aop.support.NameMatchMethodPointcut;

public class GreetingComposablePointcut {
	/**
	 * Composable 组成
	 * @return composablePointcut 组合切点
	 */
   public Pointcut getIntersectionPointcut(){
	   ComposablePointcut cp = new ComposablePointcut();
	   Pointcut pt1 = new ControlFlowPointcut(WaiterDelegate.class,"service");// 控制流程切点
	   NameMatchMethodPointcut pt2 = new NameMatchMethodPointcut(); // spring 实现的 方法，静态，名切点
	   pt2.addMethodName("greetTo");
	   return cp.intersection(pt1).intersection((Pointcut)pt2);  // intersection (交集)
   }
}
